function yerefresh(){
    location.reload(true);
}
function hide(){
    if($("#searchheader").css("display")=="none"){
        $("#searchheader").css("display","block");
        $("#hide").text("收起筛选")
    }else if($("#searchheader").css("display")=="block"){
        $("#searchheader").css("display","none");
        $("#hide").text("打开筛选")
    }
}
function aa(res1,res2) {
    if(res1==0){
        return '<div style="line-height: 50px">'+'未审核' + '<br/>' + '<a className="layui-btn" onClick="auditprocess('+res2+');">'+'审核详情'+'</a>'+'</div>';
    }else if(res1==1){
        return '<div style="line-height: 50px">'+'已通过' + '<br/>' + '<a className="layui-btn" onClick="auditprocess('+res2+');">'+'审核详情'+'</a>'+'</div>';
    }else if(res1==2){
        return '<div style="line-height: 50px">'+'未通过' + '<br/>' + '<a className="layui-btn" onClick="auditprocess('+res2+');">'+'审核详情'+'</a>'+'</div>';
    }
}
function auditprocess(id){
    localStorage.setItem("auditprocessid",id);
    layer.open({
        type: 2,
        title: '审核详情',
        content: "../courseaudit/auditprocess.html",
        area: ['80%', '80%'],
    })
}
window.name="upload";
function refresh1() {
    tableIn.reload("demo");
}
var tableIn=null;
var kcname=null;
var title1=null;
var data1=null;
    layui.use(['table','dropdown','form','laydate'], function () {
        console.log(data1)
        var form=layui.form
        var dropdown = layui.dropdown
        var table = layui.table;
        var laydate = layui.laydate;
        //监听开关按钮
        laydate.render({
            elem: '#date' //指定元素
        });
        table.on('tool(test)', function(obj){
            var data = obj.data;
            var layEvent = obj.event;
            var tr = obj.tr;

            if(layEvent === 'detail'){ //查看
                console.log(data);
                console.log(data.id)
                localStorage.setItem("versionid",data.id)
                //do somehing
                layer.open({
                    type: 2,
                    title: '查看版本',
                    content: "selectversion.html",
                    area: ['80%', '80%'],
                })
            }
        });
        //第一个实例
        tableIn = table.render({
            elem: '#demo'
            , height: 800
            , id: 'demo'
            , url: '/advanced/getversionmanager' //数据接口
            , page: true //开启分页
            , cols: [[ //表头
                {type: 'checkbox', fixed: 'left'},
                {field: 'id', title: '序号'},
                {field: 'versionid', title: '版本编号'},
                {field: 'versionname', title: '版本名称'},
                {field: 'appname', title: 'APP名称'},
                {field: 'createname', title: '创建人'},
                {field: 'createtime', title: '创建时间'},
                {title: '操作',width:150, toolbar: '#barDemo'}
            ]],
            parseData: function (res) { //res 即为原始返回的数据
                return {
                    "code": res.state, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.total, //解析数据长度
                    "data": res.data //解析数据列表
                };
            },
        });
        $("#selectkc").click(function(){
            var versionid=$("#versionid").val();
            var createtime=$("#date").val();
            var createname=$("#createname").val();
            table.reload('demo',{
                where:{
                    versionid:versionid,
                    time:createtime,
                    createname:createname,
                }
            })
        })
    });
// $("#selectadd").click(function () {
//     layer.open({
//         type: 2,
//         title: '添加',
//         content: "addcourse.html",
//         area: ['80%', '80%'],
//     })
// })
